Skip to content

Add copy workspace path button to thread action menu#1128

Merged
juliusmarminge merged 2 commits intopingdotgg:mainfrom
jamesx0416:t3code/copy-thread-path-menu
Mar 17, 2026
Merged

Add copy workspace path button to thread action menu#1128
juliusmarminge merged 2 commits intopingdotgg:mainfrom
jamesx0416:t3code/copy-thread-path-menu

Conversation

@jamesx0416
Copy link
Contributor

@jamesx0416 jamesx0416 commented Mar 16, 2026

What Changed

Adds a Copy Path action to the thread right-click menu in the left sidebar.

The copied path prefers the thread worktree path and falls back to the project cwd when the thread is not using a separate worktree.

Why

This makes it easier to grab the workspace path for a thread directly from the sidebar without opening the thread and manually finding the path elsewhere.

UI Changes

Adds a new Copy Path entry to the existing thread context menu in the sidebar.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Verification

  • bun lint
  • bun typecheck

Screenshots

Before:
Screenshot 2026-03-16 at 12 46 11 pm

After:
Screenshot 2026-03-16 at 12 46 02 pm

Note

Add 'Copy Path' option to thread context menu in sidebar

Adds a new "Copy Path" item to the right-click context menu for threads in Sidebar.tsx. The item copies the thread's worktreePath, falling back to the project's current working directory, and shows a success or error toast based on availability.

Macroscope summarized 26123af.

Summary by CodeRabbit

  • New Features
    • Added "Copy Path" functionality to thread context menus, enabling users to conveniently copy workspace paths directly to their clipboard.
    • Displays appropriate notifications: success messages when paths are copied and error messages when operations fail or path data is unavailable.

@coderabbitai
Copy link

coderabbitai bot commented Mar 16, 2026

📝 Walkthrough

Walkthrough

A "Copy Path" option was added to the thread context menu in the Sidebar component. The feature resolves the thread workspace path using thread.worktreePath or projectId fallback, validates the thread exists, and copies the path to clipboard with appropriate success or error toast notifications.

Changes

Cohort / File(s) Summary
Thread Context Menu Enhancement
apps/web/src/components/Sidebar.tsx
Added "Copy Path" option to thread context menu with path resolution logic (worktreePath or projectId fallback), thread validation, clipboard copy functionality, and toast notifications for success/error states. Updated handleThreadContextMenu dependencies to include projectCwdById.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A path to copy, snip-snap-snap,
Through menus hopping, context-mapped,
Toast notifications, golden and bright,
Thread threads threaded, everything right!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding a copy workspace path button to the thread action menu, which matches the core functionality described in the changeset.
Description check ✅ Passed The PR description comprehensively covers all template requirements with clear sections explaining changes, rationale, and UI impact, supported by before/after screenshots.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Mar 16, 2026
@jamesx0416 jamesx0416 changed the title Add thread context menu action to copy workspace path Add copy workspace path button to thread action menu Mar 16, 2026
@jamesx0416
Copy link
Contributor Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Mar 16, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
apps/web/src/components/Sidebar.tsx (1)

660-684: Consider extracting shared clipboard+toast flow.

copy-path and copy-thread-id now repeat nearly identical copy/error toast handling. A small helper would reduce drift and keep copy actions consistent.

Refactor sketch
+const copyValueWithToast = async ({
+  value,
+  successTitle,
+  failureTitle,
+}: {
+  value: string;
+  successTitle: string;
+  failureTitle: string;
+}) => {
+  try {
+    await copyTextToClipboard(value);
+    toastManager.add({ type: "success", title: successTitle, description: value });
+  } catch (error) {
+    toastManager.add({
+      type: "error",
+      title: failureTitle,
+      description: error instanceof Error ? error.message : "An error occurred.",
+    });
+  }
+};
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/web/src/components/Sidebar.tsx` around lines 660 - 684, Extract the
repeated clipboard + toast logic into a helper like
copyToClipboardWithToast(text: string, options?: {successTitle?: string,
successDescription?: string, errorTitle?: string}) and use it from the click
handlers for "copy-path" and "copy-thread-id"; move the existing try/catch and
toastManager.add calls into that helper, have it check for empty text (returning
a failure toast similar to the current "Path unavailable"), call
copyTextToClipboard inside the try block, and surface either a success toast
with the provided title/description or an error toast using error instanceof
Error ? error.message : "An error occurred." so both handlers call
copyToClipboardWithToast(threadWorkspacePath, {successTitle: "Path copied"}) and
copyToClipboardWithToast(threadId, {successTitle: "Thread ID copied"})
respectively.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@apps/web/src/components/Sidebar.tsx`:
- Around line 660-684: Extract the repeated clipboard + toast logic into a
helper like copyToClipboardWithToast(text: string, options?: {successTitle?:
string, successDescription?: string, errorTitle?: string}) and use it from the
click handlers for "copy-path" and "copy-thread-id"; move the existing try/catch
and toastManager.add calls into that helper, have it check for empty text
(returning a failure toast similar to the current "Path unavailable"), call
copyTextToClipboard inside the try block, and surface either a success toast
with the provided title/description or an error toast using error instanceof
Error ? error.message : "An error occurred." so both handlers call
copyToClipboardWithToast(threadWorkspacePath, {successTitle: "Path copied"}) and
copyToClipboardWithToast(threadId, {successTitle: "Thread ID copied"})
respectively.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: dc7bb203-8b66-4563-b073-d33616adbc10

📥 Commits

Reviewing files that changed from the base of the PR and between 4b811da and 94dfe02.

📒 Files selected for processing (1)
  • apps/web/src/components/Sidebar.tsx

- Add `Copy Path` to the thread context menu in the sidebar
- Resolve thread path from `worktreePath` with project cwd fallback
- Show success/error toasts for copy and unavailable path cases
@jamesx0416 jamesx0416 force-pushed the t3code/copy-thread-path-menu branch from 94dfe02 to 46fc372 Compare March 16, 2026 01:46
@jamesx0416
Copy link
Contributor Author

Also, why is 30 - 99 lines considered medium? It's not a big change at all...

@binbandit
Copy link
Contributor

@jamesx0416 We see it as a Medium, as its not something we can just approve and believe it wont affect the UX. S and XS are usually super quick wins that barely require any time :)

@jamesx0416
Copy link
Contributor Author

jamesx0416 commented Mar 17, 2026

@binbandit I'm still quite new to open source, and I'm not very used to the etiquette.
Could you please explain to me when I can tag people? Because I know some people don't like being tagged.
And if I See a good PR that hasn't been seen by anybody. Who should I tell?

And would there be a Discord server coming soon? Thank you.

P.S. would it be easier if I link a packaged version for you guys to test out?

@binbandit
Copy link
Contributor

@jamesx0416 all good mate.

I for one am ok with being tagged on things as long as it's within reason. Don't need to be tagged on something because you find it funny 😂.

In terms of the PRs we are using tools that help us see every pr, and we are slowly getting through them all.

In terms of a discord server there is a general discord server owned by Theo where there is a generalized chat channel for t3code. But we don't recommend pasting / flooding it with pull request links.


TLDR; tag me on stuff if u want. Don't bother the other maintainers tho. If it's dope I'll pass it on for you

@jamesx0416
Copy link
Contributor Author

jamesx0416 commented Mar 17, 2026

@binbandit Thanks. Would it be easier if I link a package version of my PR for you guys to test out in the future?
Also, please do let me know if I tag you too much 😂

@juliusmarminge juliusmarminge merged commit d430a06 into pingdotgg:main Mar 17, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants